﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Anagramme.Contracts.Tests
{
    [TestClass]
    public class PlayerTests
    {
        [TestMethod]
        public void SetIdRaisePropertyChanged()
        {
            string actual = string.Empty;
            string expected = "Id";

            Player player = new Player();
            player.PropertyChanged += (s, e) => actual = e.PropertyName;
            player.Id = 3;

            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void SetIsLobbyMasterRaisePropertyChanged()
        {
            string actual = string.Empty;
            string expected = "IsLobbyMaster";

            Player player = new Player();
            player.PropertyChanged += (s, e) => actual = e.PropertyName;
            player.IsLobbyMaster = true;

            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void SetIsReadyToPlayRaisePropertyChanged()
        {
            string actual = string.Empty;
            string expected = "IsReadyToPlay";

            Player player = new Player();
            player.PropertyChanged += (s, e) => actual = e.PropertyName;
            player.IsReadyToPlay = true;

            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void SetNameRaisePropertyChanged()
        {
            string actual = string.Empty;
            string expected = "Name";

            Player player = new Player();
            player.PropertyChanged += (s, e) => actual = e.PropertyName;
            player.Name = "test";

            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void SetTeamRaisePropertyChanged()
        {
            string actual = string.Empty;
            string expected = "Team";

            Player player = new Player();
            player.PropertyChanged += (s, e) => actual = e.PropertyName;
            player.Team = new Team();

            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void InstanciateWithTokenAffectToken()
        {
            Guid expected = Guid.NewGuid();

            Player player = new Player(expected);
            Guid actual = player.Token;

            Assert.AreEqual(expected, actual);
        }
    }
}
